<meta charset="utf-8">
(#) Duplicate watch face configuration activities found

!!! WARNING: Duplicate watch face configuration activities found
   This is a warning.

Id
:   `WearableActionDuplicate`
Summary
:   Duplicate watch face configuration activities found
Severity
:   Warning
Category
:   Correctness
Platform
:   Android
Vendor
:   Android Open Source Project
Feedback
:   https://issuetracker.google.com/issues/new?component=192708
Since
:   7.3.0 (September 2022)
Affects
:   Manifest files
Editing
:   This check runs on the fly in the IDE editor
See
:   https://developer.android.com/training/wearables/watch-faces/configuration
Implementation
:   [Source Code](https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:lint/libs/lint-checks/src/main/java/com/android/tools/lint/checks/WearableConfigurationActionDetector.kt)
Tests
:   [Source Code](https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:lint/libs/lint-tests/src/test/java/com/android/tools/lint/checks/WearableConfigurationActionDetectorTest.kt)

If and only if a watch face service defines
`wearableConfigurationAction` metadata, with the value
`WATCH_FACE_EDITOR`, there should be an activity in the same package,
which has an intent filter for `WATCH_FACE_EDITOR` (with
com.google.android.wearable.watchface.category.WEARABLE_CONFIGURATION if
minSdkVersion is less than 30).

(##) Example

Here is an example of lint warnings produced by this check:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~text
src/main/AndroidManifest.xml:20:Warning: Duplicate watch face
configuration activities found [WearableActionDuplicate]
    &lt;action android:name="androidx.wear.watchface.editor.action.WATCH_FACE_EDITOR" /&gt;
    ---------------------------------------------------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Here are the relevant source files:

`build.gradle`:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~groovy linenumbers
apply plugin: 'com.android.application'

dependencies {
    implementation "androidx.wear.watchface:watchface:1.2.3"
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

`src/main/AndroidManifest.xml`:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~xml linenumbers
&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="androidx.wear.watchface.samples.minimal.style"&gt;

  &lt;uses-feature android:name="android.hardware.type.watch" /&gt;

  &lt;uses-permission android:name="android.permission.WAKE_LOCK" /&gt;

  &lt;application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:supportsRtl="true"
      android:theme="@android:style/Theme.DeviceDefault"
      android:fullBackupContent="false"&gt;

    &lt;activity
        android:name=".ConfigActivity"
        android:label="@string/configuration_title"&gt;
      &lt;intent-filter&gt;
        &lt;action android:name="androidx.wear.watchface.editor.action.WATCH_FACE_EDITOR" /&gt;

        &lt;category
            android:name="com.google.android.wearable.watchface.category.WEARABLE_CONFIGURATION" /&gt;
        &lt;category android:name="android.intent.category.DEFAULT" /&gt;
      &lt;/intent-filter&gt;
    &lt;/activity&gt;

    &lt;service
        android:name=".WatchFaceService"
        android:directBootAware="true"
        android:exported="true"
        android:label="@string/app_name"
        android:permission="android.permission.BIND_WALLPAPER"&gt;

      &lt;intent-filter&gt;
        &lt;action android:name="androidx.wear.watchface.editor.action.WATCH_FACE_EDITOR" /&gt;
      &lt;/intent-filter&gt;

      &lt;intent-filter&gt;
        &lt;action android:name="android.service.wallpaper.WallpaperService" /&gt;
        &lt;category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" /&gt;
      &lt;/intent-filter&gt;

      &lt;meta-data
          android:name="com.google.android.wearable.watchface.preview"
          android:resource="@drawable/preview" /&gt;

      &lt;meta-data
          android:name="android.service.wallpaper"
          android:resource="@xml/watch_face" /&gt;

      &lt;meta-data
          android:name="com.google.android.wearable.watchface.wearableConfigurationAction"
          android:value="androidx.wear.watchface.editor.action.WATCH_FACE_EDITOR" /&gt;

      &lt;meta-data
          android:name="com.google.android.wearable.watchface.companionBuiltinConfigurationEnabled"
          android:value="true" /&gt;

    &lt;/service&gt;

  &lt;/application&gt;

&lt;/manifest&gt;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can also visit the
[source code](https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:lint/libs/lint-tests/src/test/java/com/android/tools/lint/checks/WearableConfigurationActionDetectorTest.kt)
for the unit tests for this check to see additional scenarios.

The above example was automatically extracted from the first unit test
found for this lint check, `WearableConfigurationActionDetector.testActionDuplicate`.
To report a problem with this extracted sample, visit
https://issuetracker.google.com/issues/new?component=192708.

(##) Suppressing

You can suppress false positives using one of the following mechanisms:

* Adding the suppression attribute
  `tools:ignore="WearableActionDuplicate"` on the problematic XML
  element (or one of its enclosing elements). You may also need to add
  the following namespace declaration on the root element in the XML
  file if it's not already there:
  `xmlns:tools="http://schemas.android.com/tools"`.

* Using a special `lint.xml` file in the source tree which turns off
  the check in that folder and any sub folder. A simple file might look
  like this:
  ```xml
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;lint&gt;
      &lt;issue id="WearableActionDuplicate" severity="ignore" /&gt;
  &lt;/lint&gt;
  ```
  Instead of `ignore` you can also change the severity here, for
  example from `error` to `warning`. You can find additional
  documentation on how to filter issues by path, regular expression and
  so on
  [here](https://googlesamples.github.io/android-custom-lint-rules/usage/lintxml.md.html).

* In Gradle projects, using the DSL syntax to configure lint. For
  example, you can use something like
  ```gradle
  lintOptions {
      disable 'WearableActionDuplicate'
  }
  ```
  In Android projects this should be nested inside an `android { }`
  block.

* For manual invocations of `lint`, using the `--ignore` flag:
  ```
  $ lint --ignore WearableActionDuplicate ...`
  ```

* Last, but not least, using baselines, as discussed
  [here](https://googlesamples.github.io/android-custom-lint-rules/usage/baselines.md.html).

<!-- Markdeep: --><style class="fallback">body{visibility:hidden;white-space:pre;font-family:monospace}</style><script src="markdeep.min.js" charset="utf-8"></script><script src="https://morgan3d.github.io/markdeep/latest/markdeep.min.js" charset="utf-8"></script><script>window.alreadyProcessedMarkdeep||(document.body.style.visibility="visible")</script>